/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Busquedas.java
 *
 * Created on 24-ene-2009, 14:08:54
 */

package GUI;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

/**
 *
 * @author Jaime
 */
public class Busquedas extends javax.swing.JPanel {
    private int busqueda;
    private boolean ciclos;
    private Ventanas ventana;
    private JButton aceptar;
    /** Creates new form Busquedas */
    public Busquedas() {
        initComponents();
      //  aceptar=a;
        this.jCheckBox1.setSelected(true);
        this.jCheckBox11.setSelected(true);
       // ventana=v;
       //aceptar=new JButton("Aceptar");
       // this.jButton1.addActionListener(new OyenteAceptar());

        //aceptar.setL;
    }

    public int lanzaVentana(){
                
                this.jCheckBox1.setSelected(true);
                this.jCheckBox11.setSelected(true);
                this.jButton1.addActionListener(new OyenteAceptar());
                setVisible(true);
                return busqueda;


    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jCheckBox3 = new javax.swing.JCheckBox();
        jCheckBox4 = new javax.swing.JCheckBox();
        jCheckBox5 = new javax.swing.JCheckBox();
        jCheckBox6 = new javax.swing.JCheckBox();
        jCheckBox7 = new javax.swing.JCheckBox();
        jCheckBox8 = new javax.swing.JCheckBox();
        jCheckBox9 = new javax.swing.JCheckBox();
        jCheckBox10 = new javax.swing.JCheckBox();
        jCheckBox11 = new javax.swing.JCheckBox();
        jButton1 = new javax.swing.JButton();

        jDesktopPane1.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));

        jLabel1.setText("Búsqueda Ciega");
        jLabel1.setBounds(40, 20, 100, 14);
        jDesktopPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setText("Búsqueda Informada");
        jLabel2.setBounds(150, 20, 160, 14);
        jDesktopPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox1.setText("Primero Anchura");
        jCheckBox1.setName("pAnchu"); // NOI18N
        jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox1ActionPerformed(evt);
            }
        });
        jCheckBox1.setBounds(30, 50, 120, 23);
        jDesktopPane1.add(jCheckBox1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox2.setText("Primero Profundidad");
        jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox2ActionPerformed(evt);
            }
        });
        jCheckBox2.setBounds(30, 80, 130, 23);
        jDesktopPane1.add(jCheckBox2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox3.setText("Coste Uniforme");
        jCheckBox3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox3ActionPerformed(evt);
            }
        });
        jCheckBox3.setBounds(30, 110, 130, 23);
        jDesktopPane1.add(jCheckBox3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox4.setText("Profundidad Iterativa");
        jCheckBox4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox4ActionPerformed(evt);
            }
        });
        jCheckBox4.setBounds(30, 140, 140, 23);
        jDesktopPane1.add(jCheckBox4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox5.setText("Profundidad Limitada");
        jCheckBox5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox5ActionPerformed(evt);
            }
        });
        jCheckBox5.setBounds(30, 170, 140, 23);
        jDesktopPane1.add(jCheckBox5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox6.setText("Voraz");
        jCheckBox6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox6ActionPerformed(evt);
            }
        });
        jCheckBox6.setBounds(170, 50, 110, 23);
        jDesktopPane1.add(jCheckBox6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox7.setText("A*");
        jCheckBox7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox7ActionPerformed(evt);
            }
        });
        jCheckBox7.setBounds(170, 80, 39, 23);
        jDesktopPane1.add(jCheckBox7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox8.setText("Escalada Simple");
        jCheckBox8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox8ActionPerformed(evt);
            }
        });
        jCheckBox8.setBounds(170, 110, 101, 23);
        jDesktopPane1.add(jCheckBox8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox9.setText("Escalada Max. Pendiente");
        jCheckBox9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox9ActionPerformed(evt);
            }
        });
        jCheckBox9.setBounds(170, 140, 200, 23);
        jDesktopPane1.add(jCheckBox9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox10.setText("Enfriamiento Simulado");
        jCheckBox10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox10ActionPerformed(evt);
            }
        });
        jCheckBox10.setBounds(170, 170, 180, 23);
        jDesktopPane1.add(jCheckBox10, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox11.setText("Control Ciclos");
        jCheckBox11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox11ActionPerformed(evt);
            }
        });
        jCheckBox11.setBounds(100, 200, 120, 23);
        jDesktopPane1.add(jCheckBox11, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton1.setText("Aceptar");
        jButton1.setBounds(110, 240, 71, 23);
        jDesktopPane1.add(jButton1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
        // TODO add your handling code here:
        if (this.getJCheckBox1().isSelected()==true){
            this.getJCheckBox1().setSelected(true);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox1.setMnemonic(1);
        } else this.getJCheckBox1().setSelected(true);

    }//GEN-LAST:event_jCheckBox1ActionPerformed

    private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed
        // TODO add your handling code here:
        if (this.getJCheckBox2().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(true);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox2.setMnemonic(2);
        } else this.getJCheckBox2().setSelected(true);
    }//GEN-LAST:event_jCheckBox2ActionPerformed

    private void jCheckBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox3ActionPerformed
        if (this.getJCheckBox3().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(true);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox3.setMnemonic(3);
            }  else this.getJCheckBox3().setSelected(true);
    }//GEN-LAST:event_jCheckBox3ActionPerformed

    private void jCheckBox4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox4ActionPerformed
        if (this.getJCheckBox4().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(true);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox4.setMnemonic(4);
        } else this.getJCheckBox4().setSelected(true);
    }//GEN-LAST:event_jCheckBox4ActionPerformed

    private void jCheckBox5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox5ActionPerformed
        if (this.getJCheckBox5().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(true);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox5.setMnemonic(5);
        } else this.getJCheckBox5().setSelected(true);
    }//GEN-LAST:event_jCheckBox5ActionPerformed

    private void jCheckBox6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox6ActionPerformed
        if (this.getJCheckBox6().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(true);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox6.setMnemonic(6);
        }  else this.getJCheckBox6().setSelected(true);
    }//GEN-LAST:event_jCheckBox6ActionPerformed

    private void jCheckBox7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox7ActionPerformed
        if (this.getJCheckBox7().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(true);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox7.setMnemonic(7);
        }   else this.getJCheckBox7().setSelected(true);
    }//GEN-LAST:event_jCheckBox7ActionPerformed

    private void jCheckBox8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox8ActionPerformed
        if (this.getJCheckBox8().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(true);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox8.setMnemonic(8);
        } else this.getJCheckBox8().setSelected(true);
    }//GEN-LAST:event_jCheckBox8ActionPerformed

    private void jCheckBox9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox9ActionPerformed
        if (this.getJCheckBox9().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(true);
            this.getJCheckBox10().setSelected(false);
            this.jCheckBox9.setMnemonic(9);
        } else this.getJCheckBox9().setSelected(true);
    }//GEN-LAST:event_jCheckBox9ActionPerformed

    private void jCheckBox10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox10ActionPerformed
        if (this.getJCheckBox10().isSelected()==true){
            this.getJCheckBox1().setSelected(false);
            this.getJCheckBox2().setSelected(false);
            this.getJCheckBox3().setSelected(false);
            this.getJCheckBox4().setSelected(false);
            this.getJCheckBox5().setSelected(false);
            this.getJCheckBox6().setSelected(false);
            this.getJCheckBox7().setSelected(false);
            this.getJCheckBox8().setSelected(false);
            this.getJCheckBox9().setSelected(false);
            this.getJCheckBox10().setSelected(true);
            this.jCheckBox10.setMnemonic(10);
        } else this.getJCheckBox10().setSelected(true);
    }//GEN-LAST:event_jCheckBox10ActionPerformed

    private void jCheckBox11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox11ActionPerformed
        if (this.getJCheckBox11().isSelected()==true)
            this.getJCheckBox11().setSelected(true);
        else  this.getJCheckBox11().setSelected(false);
    }//GEN-LAST:event_jCheckBox11ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox10;
    private javax.swing.JCheckBox jCheckBox11;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox3;
    private javax.swing.JCheckBox jCheckBox4;
    private javax.swing.JCheckBox jCheckBox5;
    private javax.swing.JCheckBox jCheckBox6;
    private javax.swing.JCheckBox jCheckBox7;
    private javax.swing.JCheckBox jCheckBox8;
    private javax.swing.JCheckBox jCheckBox9;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the busqueda
     */
    public int getBusqueda() {
        return busqueda;
    }

    /**
     * @return the ciclos
     */
    public boolean isCiclos() {
        return ciclos;
    }

    /**
     * @return the jCheckBox1
     */
    public javax.swing.JCheckBox getJCheckBox1() {
        return jCheckBox1;
    }

    /**
     * @return the jCheckBox10
     */
    public javax.swing.JCheckBox getJCheckBox10() {
        return jCheckBox10;
    }

    /**
     * @return the jCheckBox11
     */
    public javax.swing.JCheckBox getJCheckBox11() {
        return jCheckBox11;
    }

    /**
     * @return the jCheckBox2
     */
    public javax.swing.JCheckBox getJCheckBox2() {
        return jCheckBox2;
    }

    /**
     * @return the jCheckBox3
     */
    public javax.swing.JCheckBox getJCheckBox3() {
        return jCheckBox3;
    }

    /**
     * @return the jCheckBox4
     */
    public javax.swing.JCheckBox getJCheckBox4() {
        return jCheckBox4;
    }

    /**
     * @return the jCheckBox5
     */
    public javax.swing.JCheckBox getJCheckBox5() {
        return jCheckBox5;
    }

    /**
     * @return the jCheckBox6
     */
    public javax.swing.JCheckBox getJCheckBox6() {
        return jCheckBox6;
    }

    /**
     * @return the jCheckBox7
     */
    public javax.swing.JCheckBox getJCheckBox7() {
        return jCheckBox7;
    }

    /**
     * @return the jCheckBox8
     */
    public javax.swing.JCheckBox getJCheckBox8() {
        return jCheckBox8;
    }

    /**
     * @return the jCheckBox9
     */
    public javax.swing.JCheckBox getJCheckBox9() {
        return jCheckBox9;
    }


  	class OyenteAceptar implements ActionListener{

		public void actionPerformed(ActionEvent evento) {
             if (jCheckBox1.isSelected()==true) busqueda = jCheckBox1.getMnemonic();
             if (jCheckBox2.isSelected()==true) busqueda = jCheckBox2.getMnemonic();
             if (jCheckBox3.isSelected()==true) busqueda = jCheckBox3.getMnemonic();
             if (jCheckBox4.isSelected()==true) busqueda = jCheckBox4.getMnemonic();
             if (jCheckBox5.isSelected()==true) busqueda = jCheckBox5.getMnemonic();
             if (jCheckBox6.isSelected()==true) busqueda = jCheckBox6.getMnemonic();
             if (jCheckBox7.isSelected()==true) busqueda = jCheckBox7.getMnemonic();
             if (jCheckBox8.isSelected()==true) busqueda = jCheckBox8.getMnemonic();
             if (jCheckBox9.isSelected()==true) busqueda = jCheckBox9.getMnemonic();
             if (jCheckBox10.isSelected()==true) busqueda = jCheckBox10.getMnemonic();

             ciclos=jCheckBox1.isSelected();
             ventana.setVisible(false);


		}

	}

}
